<template>
    <div style="width:80%">
        <h3>用户信息管理</h3>
        <el-table
        :data="user"
        style="width: 100%;text-align:center">
            <el-table-column
                prop="name"
                label="真实姓名"
                >
            </el-table-column>
            <el-table-column
                prop="address"
                label="收货地址"
            >
            </el-table-column>
            <el-table-column
                prop="username"
                label="用户名">
            </el-table-column>
            <el-table-column
                prop="loginaccount"
                label="登陆账户">
            </el-table-column>
            <el-table-column
                prop="loginpassword"
                label="登陆密码">
            </el-table-column>
            <el-table-column
                prop="paymentpassword"
                label="支付密码">
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
export default {
    data(){
        return{
            user:[
                {"name":"张三","address":"北京市","username":"helloword","loginaccount":"1234444555","loginpassword":"123456","paymentpassword":"1234567"}
            ]
        }
    },
    methods:{
        useredit(){
            this.$router.push("/")
        },
        userdel(){
            this.$router.push("/")
        }
    },
   mounted:function(){
        let url="/api/tcb/databasequery?access_token=38_cG02NOgSGg2aN0SrPi6U14KviA1c-9RJgynM1eBEULC7unvKpkah92AnbFnA6ochkRnsf3p1mI_dkeSfRqVJ1K6RZlPTn_sI5hveRvTKIx08RZkenWZbptorcpcHo2vzGc_zNHSbJL2rqHzTZYDeAJADCH"
        this.$axios.post( url,
            {
                "env":"minijingdong-6gmzb5oc4447b462",
                "query":"db.collection(\"user\").get()"
            }
        ).then(res=>{
            console.log(res)
            res=res.data.data;
            res.forEach(item => {
                this.user.push(JSON.parse(item))
            });
        }).catch(err=>{
            console.log(err)
        })
      },
}
</script>